package com.sskj.mine.account;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.UserData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.presenter.BasePresenter;
import com.sskj.mine.account.AddAccountActivity;


/**
 * @author Hey
 * Create at  2019/05/03
 */
class AddAccountPresenter extends BasePresenter<AddAccountActivity> {
    public void addAccount(String account, String nickname, String password, String repassword) {
        OkGo.<HttpData<Object>>post(HttpConfig.BASE_URL + HttpConfig.ADD_ACCOUNT)
                .params("account",account)
                .params("nickname",nickname)
                .params("password",password)
                .params("repassword",repassword)
                .execute(new JsonCallBack<HttpData<Object>>(this, false) {
                    @Override
                    public void onSuccess(Response<HttpData<Object>> response) {
                        HttpData<Object> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.finish();
                        }
                    }
                });
    }
}
